<template>
  <div class="person">
    <h2>当前求和为：{{ sum }},放大10倍后为{{ bigSum }}</h2>
    <button @click="changeSum">点我sum+1</button>
    <hr>
    <img v-for="(dog,index) in dogList" :src="dog" alt="" :key="index"> <br>
    <button @click="getDog">再来一只小狗</button>
  </div> 
</template>

<script lang="ts" setup name="Person">
  import useDog from '@/hooks/useDog';
  import useSum from '@/hooks/useSum';
  // hooks的作用就是将一个功能的数据、方法、计算属性都封装在一起，组合式API
  const {sum,changeSum,bigSum} = useSum()
  const {dogList,getDog} = useDog()
</script>

<style>
  .person{
    background-color: skyblue;
    box-shadow: 0 0 10px;
    border-radius: 10px;
    padding: 20px;
  }
  button{
    margin: 0 5px;
  }
  ul li{
    font-size: 20px;
  }
  img{
    height: 100px;
    margin-left: 10px;
  }
</style>